/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-19
 * Time: 16:20
 */
import java.util.Scanner;


abstract class Ticket{
    public int number;
    public Ticket(int number) {
        this.number = number;
    }
    public int getNumber() {
        return number;
    }
    public void setNumber(int number) {
        this.number = number;
    }
    abstract public int getPrice();
    public String toString() {
        return "Number:"+number+",Price:"+getPrice();
    }
}
class WalkupTicket extends Ticket{

    public WalkupTicket(int number) {
        super(number);
        // TODO Auto-generated constructor stub
    }

    @Override
    public int getPrice() {
        // TODO Auto-generated method stub
        return 50;
    }
    public String toString() {
        return "Number:"+super.getNumber()+",Price:"+getPrice();
    }

}
class AdvanceTicket extends Ticket{
    private int leadTime;
    public AdvanceTicket(int number,int leadTime) {
        super(number);
        this.leadTime = leadTime;
        // TODO Auto-generated constructor stub
    }

    @Override
    public int getPrice() {
        // TODO Auto-generated method stub
        if(leadTime>10) {
            return 30;
        }
        return 40;
    }

    public int getLeadTime() {
        return leadTime;
    }
    public int getNumber() {
        return super.getNumber();
    }
    public String toString() {
        return "Number:"+super.getNumber()+",Price:"+getPrice();
    }
}
class StudentAdvanceTicket extends AdvanceTicket{
    private int height;
    public StudentAdvanceTicket(int number, int leadTime, int height) {
        super(number, leadTime);
        this.height = height;
        // TODO Auto-generated constructor stub
    }
    public int getPrice() {
        if(height>=120) {
            if(super.getLeadTime()>10) {
                return 20;
            }else {
                return 30;
            }
        }else {
            if(super.getLeadTime()>10) {
                return 10;
            }else {
                return 15;
            }
        }
    }
    public String toString() {
        return "Number:"+super.getNumber()+",Price:"+getPrice();
    }
}
public class Main{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Ticket a = new WalkupTicket(in.nextInt());
        System.out.println(a.toString());
        Ticket b = new AdvanceTicket(in.nextInt(), in.nextInt());
        System.out.println(b.toString());
        Ticket c = new StudentAdvanceTicket(in.nextInt(), in.nextInt(), in.nextInt());
        System.out.println(c.toString());

    }
}